package com.game.battle.start;

//import java.io.IOException;
//import java.io.InputStream;
//import java.util.Properties;

//import org.slf4j.Logger;
//

//import com.game.common.config.BaseLocalConfigInitializer;
//import com.game.common.config.BaseServerConfig;
//import com.game.core.dbcs.DBCS;
//import com.game.core.dbcs.DBCSConst;
//import com.game.core.dbcs.config.DbConfigInfo;

public class ServerConfigInitializer
{
//	static private Logger logger = LoggerFactory.getLogger(ServerConfigInitializer.class);
//	private BaseServerConfig config;
//
//	public void init(BaseServerConfig config) throws Exception
//	{
//		BaseLocalConfigInitializer baseLocalInitializer = new BaseLocalConfigInitializer();
//		baseLocalInitializer.init(config);
//		this.config = config;
//		//loadDBConfig();
//	}
	
//	private void loadDBConfig() throws Exception
//	{                                                                                                  
//		InputStream propertiesStream = null;
//		propertiesStream = ServerConfigInitializer.class.getResourceAsStream("/db.properties");
//		
//		Properties properties = new Properties();
//		try
//		{
//			properties.load(propertiesStream);
//		} 
//		catch (IOException e)
//		{
//			logger.error("Failed load base local config from /db.properties");
//			throw e;
//		}
//
//		String dbHostName = properties.getProperty("DBHostName");
//		String dbName = properties.getProperty("DBName");
//		String userName = properties.getProperty("UserName");
//		String password = properties.getProperty("Password");
//		
//		if (dbHostName == null || dbName == null || userName == null || password == null)
//		{
//			logger.error("Illegal content in the /db.properties");
//			throw new Exception("Illegal content in the /db.properties");
//		}
//		
//		DbConfigInfo dbConfigInfo = new DbConfigInfo(dbHostName, dbName, userName,password,DBCSConst.SQL_MAP_CONFIG);
//		DBCS.initialize(null, dbConfigInfo);
//	}
}
